//
//  MainCollectionViewCell.m
//  jianpai
//
//  Created by yrapp on 15/12/29.
//  Copyright © 2015年 yrapp. All rights reserved.
//

#import "MallCollectionViewCell.h"

@implementation MallCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        
        //self.backgroundColor = [UIColor grayColor];
        
        UIImageView *view= [[UIImageView alloc] initWithFrame:CGRectMake(0, 10, self.contentView.frame.size.width, self.contentView.frame.size.height)];
        view.backgroundColor = [UIColor whiteColor];
        view.layer.cornerRadius = 5;

        view.layer.masksToBounds = YES;


        [self addSubview:view];
        
        
        
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.width - 20)];
        _imageView.backgroundColor = [UIColor grayColor];
        [view addSubview:_imageView];
        
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_imageView.frame.origin.x + 5, _imageView.frame.size.height + 5, self.contentView.frame.size.width - 10, 15)];
        _titleLabel.textAlignment = NSTextAlignmentLeft;
        _titleLabel.text = @"炫金系列";
        _titleLabel.font = [UIFont systemFontOfSize:12];
        [view addSubview:_titleLabel];
        
        
        _priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(_imageView.frame.origin.x+5, self.contentView.frame.size.height - 25,self.contentView.frame.size.width - 20 , 15)];
        _priceLabel.text = @"¥ 600.00";
        _priceLabel.textColor = [UIColor redColor];
        _priceLabel.font = [UIFont systemFontOfSize:15];
        [view addSubview:_priceLabel];
        
        
        _addButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _addButton.frame = CGRectMake(self.contentView.frame.size.width - 10 - 25, _priceLabel.frame.origin.y, 25, 25);
        [_addButton setImage:[UIImage imageNamed:@"卖未选"] forState:(UIControlStateNormal)];
        [self addSubview:_addButton];
        
    }
    
    return self;
    
}

- (void)setModel:(prolistModel *)model {
    
    [_imageView sd_setImageWithURL:[NSURL URLWithString:model.imgsrc] placeholderImage:nil];
    
    _titleLabel.text = model.title;
    
    _priceLabel.text = [NSString stringWithFormat:@"¥ %@",model.hyj];
    
}





@end
